<template>
    <div class="header">
        <div class="header-box">
            <div class="left-slide">
                <slot name="left" v-if="leftMenu"></slot>
                <span class="back" @click="$router.go(-1)" v-else>
                    <i class="iconfont iconzuojiantou" style="font-size: 20px"></i>
                </span>
            </div>
            <h3>
                <slot></slot>
            </h3>
            <div  class="right-slide"><slot name="right"></slot></div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Header",
        props:['leftMenu']
    }
</script>

<style scoped lang="less">
    @header-height:45px;
    .header{
        .header-box{
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: @header-height;
            background: white;
            font-size: 0;
            z-index: 10;
            .left-slide{
                display: inline-block;
                width: 100px;
                height: 100%;
                font-size: 14px;
                vertical-align: top;
                line-height: @header-height;
                padding-left: 14px;
                box-sizing: border-box;
                color:#131000;
                .back{
                    display: inline-block;
                    width: 60px;
                    i{
                        color:#333;
                    }
                }
            }
            h3{
                width: 175px;
                display: inline-block;
                font-size: 18px;
                text-align: center;
                color:#333;
                vertical-align: top;
                line-height: @header-height;
                overflow: hidden;
                white-space: nowrap;
                text-overflow:ellipsis;
                font-weight:normal;
            }
            .right-slide{
                display: inline-block;
                width: 100px;
                height: 100%;
                font-size: 16px;
                vertical-align: top;
                line-height: @header-height;
                text-align: right;
                span{
                    padding: 3px 14px;
                }
            }
        }
    }
</style>
